﻿Public Class HH_UC
    Inherits System.Web.UI.UserControl

    Protected Sub addLancHHButton()

        Dim B_lanc As New Button, buttonCell As New TableCell, buttonRow As New TableFooterRow

        B_lanc.ID = "B_lanc"
        B_lanc.OnClientClick = "Lanc_hh"
        B_lanc.Text = "Lançar HH"

        buttonCell.Controls.Add(B_lanc)
        buttonRow.Controls.Add(buttonCell)
        fields_container.Controls.Add(buttonRow)

    End Sub

    Protected Sub fieldSet(ByVal Index_Id As Integer)

        Dim T_func As New TextBox, T_data As New TextBox, T_cdo As New TextBox, T_hhn As New TextBox, T_hhe As New TextBox
        Dim row As New TableRow
        Dim cel1 As New TableCell, cel2 As New TableCell, cel3 As New TableCell, cel4 As New TableCell, cel5 As New TableCell
        Dim STRIndexId As String

        If Index_Id < 10 Then
            STRIndexId = "0" & CStr(Index_Id)
        Else
            STRIndexId = CStr(Index_Id)
        End If

        T_func.ID = "T_num" & STRIndexId
        T_data.ID = "T_date" & STRIndexId
        T_cdo.ID = "T_cdo" & STRIndexId
        T_hhn.ID = "T_hhnormal" & STRIndexId
        T_hhe.ID = "T_hhextra" & STRIndexId

        cel1.Controls.Add(T_func)
        cel2.Controls.Add(T_data)
        cel3.Controls.Add(T_cdo)
        cel4.Controls.Add(T_hhn)
        cel5.Controls.Add(T_hhe)

        row.Cells.Add(cel1)
        row.Cells.Add(cel2)
        row.Cells.Add(cel3)
        row.Cells.Add(cel4)
        row.Cells.Add(cel5)
        fields_container.Controls.Add(row)

    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim func_list As New ArrayList

        For count As Integer = 1 To 3
            Call fieldSet(count)
        Next
        Call addLancHHButton()

    End Sub

    Protected Sub Lanc_hh(ByVal sender As Object, ByVal e As System.EventArgs)

        'Server.Transfer("~/Pages/Success.aspx")

    End Sub

End Class